var util = require('../../../../utils/util.js');
var common = require('../../../../utils/common.js');
var WxParse = require('../../../../utils/wxParse/wxParse.js');
var app = getApp();
var request = app.request;
var setting = app.globalData.setting;
Page({
    /**
   * 组件的初始数据
   */
  data: {
    options:{},
    user_list:[],
    newpage:1,
    goods:{}
  },
  /**
   * 生命周期函数--监听页面加载
  */
 onLoad: function (options) {
    this.options = options;
    this.getUser(options);
    wx.setNavigationBarTitle({
      title: '购买记录'
    })
  },
  getUser:function(options){
    var that=this;
    request.get('/api/goods/goodsBuyList', {
      data: {id:options.id,page: that.data.newpage,page_size:10},
      success: function (res) {
        console.log(res.data.result)
        var user_list = that.data.user_list;
        user_list = user_list.concat(res.data.result.goods.buy_numbers);
        that.setData({
          goods:res.data.result,
          user_list: user_list,
          newpage: that.data.newpage+1
        })
        }
    });
  },
  onReachBottom: function() {
    this.getUser(this.options)
  },
  /**
   * 组件的属性列表
   */
  properties: {

  },



  /**
   * 组件的方法列表
   */
  methods: {

  },
})
